﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Crusader
{
    public partial class frmSettings : Form
    {
        public frmSettings()
        {
            InitializeComponent();
        }

        private void frmSettings_Load(object sender, EventArgs e)
        {
            propertyGrid1.SelectedObject = Crusader.Settings.Instance;
        }

        private void propertyGrid1_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
        {
            Crusader.Settings.Instance.Save();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Styx.WoWInternals.ObjectManager.OnObjectListUpdateFinished += new Styx.WoWInternals.ObjectListUpdateFinishedDelegate(ObjectManager_OnObjectListUpdateFinished);
            Styx.WoWInternals.ObjectManager.Update();
            Crusader.Settings.Instance.Save();
        }

        void ObjectManager_OnObjectListUpdateFinished(object context)
        {
            
            Styx.WoWInternals.ObjectManager.OnObjectListUpdateFinished -= new Styx.WoWInternals.ObjectListUpdateFinishedDelegate(ObjectManager_OnObjectListUpdateFinished);
        }
    }
}
